const express = require('express');
// 创建一个服务的应用程序
const app = express();

// 定义中间件
const middleware = (req,res,next)=>{
    console.log('拦截器触发了');
    req.a = 10;
    next();
}
app.use('/home',middleware)
app.get('/home', (req,res)=>{
    console.log(req.a,22222);
    res.send('我是home')
})

app.get('/login', (req,res)=>{
    res.send('登录成功')
})

app.listen(9527, ()=>{
    console.log('start at port 9527');
})